package com.guarantee.server.common.base;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * @Author huisonglin
 * @Description
 * @PackageName guarantee-server
 * @Package com.guarantee.server.common.base
 * @Date 2022/9/23 16:17
 * @Version 1.0
 */
public class BaseServiceImpl <M extends BaseMapper<T>, T>{

    @Autowired
    protected M baseMapper;

    public T selectById(Serializable var1) {
        return baseMapper.selectById(var1);
    }

    public Integer insert(T t) {

        return baseMapper.insert(t);
    }

    public Integer deleteById(Serializable var1) {
        return baseMapper.deleteById(var1);
    }

    public Integer updateById(T t) {

        return baseMapper.updateById(t);
    }

    public T selectOne(@Param("ew") Wrapper<T> queryWrapper){
        return baseMapper.selectOne(queryWrapper);
    }

    public int deleteBatchIds(@Param("coll") Collection<?> idList){
        return baseMapper.deleteBatchIds(idList);
    }

    public boolean exists(Wrapper<T> queryWrapper){
        return baseMapper.exists(queryWrapper);
    }

    public List<T> selectList(@Param("ew") Wrapper<T> queryWrapper){
        return baseMapper.selectList(queryWrapper);
    }

    public int update(@Param("et") T entity, @Param("ew") Wrapper<T> updateWrapper){
        return baseMapper.update(entity,updateWrapper);
    }

}
